package com.jk.kq.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.jk.activiti.domain.Leave;
import com.jk.common.exception.KqException;
import com.jk.kq.entity.LeaveRecord;
import com.jk.common.base.IBaseService;
import com.jk.kq.entity.OpenUser;
import com.jk.kq.entity.OvertimeRecord;
import com.jk.kq.entity.vo.LeaveRecordVO;
import com.jk.sys.entity.User;
import org.activiti.engine.runtime.ProcessInstance;

import javax.servlet.http.HttpServletRequest;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
import java.util.Map;


/**
 * 请假申请服务接口层
 *
 * @author 何任鹏
 * @version 1.0
 * @date 2020年06月01日
 */
public interface ILeaveRecordService extends IBaseService<LeaveRecord> {

    /**
     * 通过openUserId查找所有的请假记录
     *
     * @param openUserId
     * @param date
     * @return
     */
    List<LeaveRecordVO> selectByOpenUserIdAndDate(Integer openUserId, LocalDate date);

    /**
     * 新增用户请假申请
     *
     * @param openUser
     * @param leaveRecord
     * @return 返回该申请需要推送的用户的集合
     */
    List<OpenUser> insert(OpenUser openUser, LeaveRecord leaveRecord);

    /**
     * 查找用户可以审核的请假申请
     *
     * @param queryMap
     */
    List selectToCheck(Map queryMap);


    ProcessInstance submitApply(LeaveRecord entity, String applyUserId, String key, Map<String, Object> variables) throws KqException;


    List<LeaveRecord> findTodoTasks(String username, Map map);

    void approval(Integer id, User user, HttpServletRequest request);


    /**
     * 暂时不做分页
     * @param para
     * @param username
     * @return
     */
    List<LeaveRecordVO> findDoneTasks(Map para, String username);
}
